package com.key.mapper;

import com.key.entity.Approval;
import com.key.entity.Assets;
import com.key.entity.BorrowAssets;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @Author: li
 * @CreateTime: 2023-02-24  19:05
 */
public interface ApprovalMapper {

    /**
     * 显示所有待审批信息
     * @param approval
     * @return
     */
    List<Approval> selectAllPendingApprovalInfo(Approval approval);

    /**
     * 显示所有已审批信息
     * @param approval
     * @return
     */
    List<Approval> selectAllAlreadyApprovalInfo(Approval approval);

    /**
     * 修改审批单状态
     * @param id
     * @return
     */
    int updateApprovalState(@Param("id") Integer id, @Param("state")String state);


    /**
     * 根据id查询单个审批单信息
     * @param id
     * @return
     */
    Approval selectOneApprovalInfo(Integer id);


    /**
     * 查询借用归还的审批单对应的资产信息
     * @param approvalNo
     * @return
     */
    List<Map<String,Long>> selectAssetsBorrowByApprovalNum(String approvalNo);

    /**
     * 查询领用退库的审批单对应的资产信息
     * @param approvalNo
     * @return
     */
    List<Map<String,Long>> selectAssetsReceiptByApprovalNum(String approvalNo);

    /**
     * 修改资产状态
     * @param assetsId
     * @return
     */
    int updateAssetsStateByApproval(Long assetsId);

    /**
     * 显示员工借用申请信息
     * @param approval
     * @return
     */
    List<Approval> selectEmpBorrowInfo(Approval approval);

    /**
     * 显示员工领用申请信息
     * @param approval
     * @return
     */
    List<Approval> selectEmpCollectingInfo(Approval approval);


    /**
     * 添加审批单
     * @param approval
     * @return
     */
    int insertApproval(Approval approval);



}
